package jmine.tec.web.wicket.cronExpression;

import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;

/**
 * Strategy to help the creation of types of cron expression. The interface contains the methods to: - Build the fields of the wicket
 * component. - Build populated fields of the wicket component (usually to edit pages). - Null checker of the component fields. The last
 * method is used to set the cron expression on the iModel, refreshing everytime a field is changed. The cron expression format is:
 * 'seconds' 'minutes' 'hours' 'days' 'months' 'weekDays' 'year'.
 * 
 * @author Fabio Sakiyama
 * @created 24/11/2011
 */
public interface CronExpressionTypeStrategy {

    /**
     * Return a {@link Panel} that contains all specific fields needed for the cron expression.
     * 
     * @param iModel model to set the cron expression.
     * @param excludeFields optional fields ({@link OptionalComponentsEnum}) that can be excluded from the page.
     * @return {@link Panel} that contains all specific fields needed for the cron expression.
     */
    Panel buildScreenFields(IModel<String> iModel, OptionalComponentsEnum... excludeFields);

    /**
     * This method, usually to edit pages, populate the fields of the component.
     * 
     * @param cronExpression to set the component fields.
     */
    void populateScreenFields(String cronExpression);

    /**
     * Method used to null check all fields everytime a field is changed. It's needed because everytime we change a field, we'll refresh the
     * whole cron expression, and we can't set null values.
     * 
     * @return <code>true</code> if there's no null field <code>false</code> otherwise.
     */
    boolean nullCheckAllFields();

}
